﻿<!--#include file="include/conn_f.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="top.asp"-->
<!--#include file="left.asp"-->
<%
showall=cint(request("showall"))
If Session("cust_id")="" Then
    Response.Write "请先登录会员,再使用此功能!"
Else
    
%>

<div class="content">
<table width="750" border="1" align="center" cellspacing="0" class="little">
    <caption>
        <center>
            消费历史记录&nbsp;&nbsp;<br />
            <%
If showall="0" Then
    Response.Write "以下显示的是未隐藏的定单(<a href='history.asp?showall=1'>请显示所有(含隐藏)定单&gt;&gt;</a>)"
Else
    Response.Write "以下显示的是所有(含已隐藏)定单(<a href='history.asp?showall=0'>请不要显示已隐藏定单</a>)"
End If

            %>
            <tr>
                <td>
                    定单号
                </td>
                <td>
                    物品(卡)名称
                </td>
                <td>
                    面额
                </td>
                <td>
                    数量
                </td>
                <td>
                    定单日期<br />
                    (北京时间)
                </td>
                <td>
                    付款状态
                </td>
                <td>
                    付款方式
                </td>
                <td>
                    定单状态
                </td>
                <td>
                    查看详情
                </td>
                <td>
                    隐藏
                </td>
            </tr>
            <%
    sql="select * from orders where cust_id="&Session("cust_id")
    If showall="0" Then
        sql=sql&" and read_status<>1 "
    End If
    sql=sql&" order by orders_id desc"
    Set rs=conn.execute(sql)

    while Not rs.eof 
        If rs("status")=0 Then
            Response.Write "<tr>"
        Else
            Response.Write "<tr bgcolor='#8AEC55'>"
        End If
        Response.Write "<td><a href='history_detail.asp?orders_id="&rs("orders_id")&"'>"&rs("orders_id")&"</a></td>"
        If rs("goods_type")=2 Then
            Response.Write "<td>代汇款/代购</td><td>&nbsp;</td><td>&nbsp;</td>"
        ElseIf rs("goods_type")=5 Then
            Response.Write "<td>储值</td><td>&nbsp;</td><td>&nbsp;</td>"
        ElseIf rs("goods_type")=6 Then
            Response.Write "<td>游戏币</td><td>&nbsp;</td><td>&nbsp;</td>"
        Else
            sql="select a.miane,b.card_name from card as a left join card_infor as b on a.card_infor_id=b.card_info_id where card_id="&rs("card_1")
            Set rs_card=conn.execute(sql)
            If Not rs_card.eof Then
                Response.Write "<td>"&rs_card("card_name")&"</td><td>"&rs_card("miane")&"</td>"				
            End If
            Response.Write "<td>"&rs("card_1_amount")&"</td>"
        End If
        Response.Write "<td>"&GetBeijingTime(rs("order_time"))&"</td>"

        If rs("pay_status")=0 Then
            Response.Write "<td>未付款</td>"
        ElseIf rs("pay_status")=1 or rs("pay_status")=2 Then
            Response.Write "<td>已付款</td>"		
        ElseIf rs("pay_status")=3 Then
            Response.Write "<td>处理中</td>"
        ElseIf rs("pay_status")=4 Then
            Response.Write "<td>已退款</td>"
        ElseIf rs("pay_status")=6 Then
            Response.Write "<td>有问题,请联系客服</td>"
        ElseIf rs("pay_status")=5 Then
            Response.Write "<td>冻结,请联系客服</td>"
        Else
            Response.Write "<td>Unknown</td>"		
        End If
        Response.Write "<td>"&GetPayMethod(rs("pay_method"))&"</td>"
        select case rs("status")
            case 0	Response.Write "<td>未处理</td>"
            case 2	Response.Write "<td>处理中</td>"
            case 5	Response.Write "<td>处理中</td>"
            case 9	Response.Write "<td>缺货</td>"
            case 6	Response.Write "<td>请联系客服</td>"
            case 7	Response.Write "<td>即将退款</td>"
            case 1 Response.Write "<td>已处理</td>"
            case 3 Response.Write "<td>已处理</td>"
            case 4 Response.Write "<td>作废(已退款)</td>"
            case Else	Response.Write "<td>不详</td>"
        end select		
        Response.Write "<td><a href='history_detail.asp?orders_id="&rs("orders_id")&"'>查看详情</a></td>"
        If rs("read_status")=1 Then
            Response.Write "<td>已隐藏(<a href='history_dele.asp?orders_id="&rs("orders_id")&"&read=0'>显示它</a>)</td>"
        Else
            Response.Write "<td><a href='history_dele.asp?orders_id="&rs("orders_id")&"&read=1'>隐藏它</a></td>"
        End If
        Response.Write "</tr>"
        rs.movenext
    wend
End If
            %>
</table>
</div>
<!--#include file="bottom.asp"-->
